﻿<div class="row-fluid sortable">
	<div class="box span12">
		<div class="box-header well" data-original-title>
			<h2>
				<i class="icon-edit">
				</i>
				Thay đổi mật khẩu
			</h2>
			<div class="box-icon">
				<?php FormHelper::getBoxIcon(); ?>
			</div>
		</div>
		<div class="box-content">
			<?php 
            $form=$this->beginWidget('CActiveForm', array(
            	'id'=>'user-form',
            	// Please note: When you enable ajax validation, make sure the corresponding
            	// controller action is handling ajax validation correctly.
            	// There is a call to performAjaxValidation() commented in generated controller code.
            	// See class documentation of CActiveForm for details on this.
            	'enableAjaxValidation'=>false,
                'htmlOptions'=>array(
                    'class'=>'form-horizontal',
                ),
            )); 
        ?>
			<fieldset>
            <?php
                if(isset($_GET['status'])&&is_numeric($_GET['status'])){
                    switch ($_GET['status']) {
                    case 1:
                        echo '<div class="alert alert-success">
    							<button type="button" class="close" data-dismiss="alert">×</button>
    							<strong>Hey!</strong> Cập nhật mật khẩu thành công.
    						</div>';
                        break;
                    case 0:
                        echo '<div class="alert alert-info">
    							<button type="button" class="close" data-dismiss="alert">×</button>
    							<strong>Rất tiếc!</strong> Cập nhật mật khẩu thất bại.
    						</div>';
                        break;
                    case 2:
                        echo '<div class="alert alert-error">
    							<button type="button" class="close" data-dismiss="alert">×</button>
    							<strong>Ồ!</strong> Mật khẩu cũ không đúng.
    						</div>';
                        break;
                 }    
                }
            ?>
			<div class="control-group">
				    <?php echo $form->labelEx($model, 'email',FormHelper::setClass('labelEx')); ?>		
        			<div class="controls">
                        <?php echo $form->textField($model,'email',FormHelper::setClass('textField')); ?>
        			    <?php echo $form->error($model, 'email'); ?>
        			</div>
			</div>
			<div class="control-group">
				<?php echo $form->labelEx($model, 'old_password',FormHelper::setClass('labelEx')); ?>
				<div class="controls">
                    <?php echo $form->passwordField($model, 'old_password',FormHelper::setClass('textField')); ?>
    				<?php echo $form->error($model, 'old_password'); ?>
                </div>
			</div>
			<div class="control-group">
				<?php echo $form->labelEx($model, 'new_password',FormHelper::setClass('labelEx')); ?>
                <div class="controls">
				    <?php echo $form->passwordField($model, 'new_password',FormHelper::setClass('textField')); ?>
				    <?php echo $form->error($model, 'new_password'); ?>
                </div>
			</div>
			<div class="control-group">
				<?php echo $form->labelEx($model, 'repeat_password',FormHelper::setClass('labelEx')); ?>
                <div class="controls">
    				<?php echo $form->passwordField($model, 'repeat_password',FormHelper::setClass('textField')); ?>
    				<?php echo $form->error($model, 'repeat_password'); ?>
                </div>
			</div>
			<div class="form-actions">
				<?php echo CHtml::submitButton($model->isNewRecord ? 'Thêm mới' : 'Lưu thay đổi',FormHelper::setClass('submitButton')); ?>
			</div>
				</fieldset>
			<?php $this->endWidget(); ?>
		</div>
	</div>
	<!--/span-->
</div>